public class Test {

    public static void swa(int [] array){
        array = new int[] {100,200};
        array[0]=300;
    }
    public static void main(String[] args) {
        int [] array = {1,2,3};
        System.out.println(array[0]+" "+array[1]);
        swa(array);
        System.out.println(array[0]+" "+array[1]);
    }
    //引用变量的数值的交换
    public static void swap (int [] array){
        int temp = array [0];
        array[0]= array[1];
        array [1] = temp;
    }

    public static void main1(String[] args) {
        int [] array = {1,2,3};
        System.out.println(array[0]+" "+array[1]);
        swap(array);
        System.out.println(array[0]+" "+array[1]);
    }
}
